package edu.xhu.biliuser.feign;

import edu.xhu.biliuser.service.BiliUserService;
import edu.xhu.model.biliuser.dtos.UserInfosDto;
import edu.xhu.model.common.dtos.ResponseResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;

@Api(value = "biliUserFeignApi", tags = "biliUserFeignApi")
@CrossOrigin
@RestController
@RequiredArgsConstructor
@RequestMapping("/biliuser")
public class BiliUserApi {
    private final BiliUserService biliUserService;

    @PostMapping("/userAllInfosByIds")
    @ApiOperation("根据用户ids获取用户的全部信息")
    ResponseResult<?> queryAllUserInfoByIds(@RequestBody UserInfosDto commentUserInfosDto) {
        return biliUserService.queryAllUserInfoByIds(commentUserInfosDto.getUserIds());
    }

    @PostMapping("/userInfoById")
    @ApiOperation("根据用户id获取用户的全部信息")
    ResponseResult<?> queryUserInfoById(@RequestParam("userId") Long userId) {
        return biliUserService.queryUserInfoById(userId);
    }

    @GetMapping("/getRatioDataByUserId")
    @ApiOperation("根据userId,获取一些响应比数据")
    ResponseResult<?> getRatioDataByUserId(@RequestParam("userId") Long userId) {
        return biliUserService.getRatioDataByUserId(userId);
    }

    @GetMapping("/getOne")
    ResponseResult<?> getOneUserById(@RequestParam("userId") Long userId) {
        return biliUserService.getOneUserById(userId);
    }

}
